<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
      <el-form-item label="服务订单号" prop="valueAddedServiceOrderNo">
        <el-input
          v-model="queryParams.valueAddedServiceOrderNo"
          placeholder="增值服务订单号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item label="机构名称" prop="institutionId">
        <el-select v-model="queryParams.institutionId" filterable placeholder="请选择机构" clearable size="small" @change="selectGrade">
          <el-option
            v-for="dept in deptList"
            :key="dept.institutionId"
            :label="dept.institutionName"
            :value="dept.institutionId"
          />
        </el-select>
      </el-form-item>

      <el-form-item label="年级名称" prop="gradeId">
        <el-select v-model="queryParams.gradeId" placeholder="请选择年级" clearable size="small" @change="selectClass">
          <el-option
            v-for="dept in gradeList"
            :key="dept.gradeId"
            :label="dept.gradeName"
            :value="dept.gradeId"
          />
        </el-select>
      </el-form-item>

      <el-form-item label="班级名称" prop="classId">
        <el-select v-model="queryParams.classId" placeholder="请选择班级" clearable size="small" @change="selectChild">
          <el-option
            v-for="dept in classList"
            :key="dept.classId"
            :label="dept.className"
            :value="dept.classId"
          />
        </el-select>
      </el-form-item>

      <el-form-item label="孩子姓名" prop="childId">
        <el-select v-model="queryParams.childId" placeholder="请选择孩子" clearable size="small">
          <el-option
            v-for="dept in childList"
            :key="dept.childId"
            :label="dept.childName"
            :value="dept.childId"
          />
        </el-select>
      </el-form-item>

      <el-form-item label="开始时间" prop="createTimeStart">
        <el-date-picker v-model="queryParams.createTimeStart" format="yyyy-MM-dd"
                        value-format="yyyy-MM-dd" :style="{width: '100%'}" placeholder="请选择开始时间" clearable>
        </el-date-picker>
      </el-form-item>

      <el-form-item label="结束时间" prop="createTimeEnd">
        <el-date-picker v-model="queryParams.createTimeEnd" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                        :style="{width: '100%'}" placeholder="请选择结束时间" clearable>
        </el-date-picker>
      </el-form-item>

      <el-form-item label="订单状态" prop="orderStatus">
        <el-select v-model="queryParams.orderStatus" placeholder="请选择订单状态" :style="{width: '100%'}" clearable>
          <el-option v-for="(item, index) in orderStatusOptions" :key="index" :label="item.label"
                     :value="item.value" :disabled="item.disabled">
          </el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="支付渠道" prop="payMode">
        <el-select v-model="queryParams.payMode" placeholder="请选择支付渠道" :style="{width: '100%'}" clearable>
          <el-option v-for="(item, index) in payModeOptions" :key="index" :label="item.label"
                     :value="item.value" :disabled="item.disabled"></el-option>
        </el-select>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
      <!--      <el-form-item label="增值服务项id" prop="itemId">
              <el-input
                v-model="queryParams.itemId"
                placeholder="请输入增值服务项id"
                clearable
                size="small"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="增值服务类型,对应字典表sys_dictionary中ValueAddedServiceType" prop="itemType">
              <el-select v-model="queryParams.itemType" placeholder="请选择增值服务类型,对应字典表sys_dictionary中ValueAddedServiceType" clearable size="small">
                <el-option label="请选择字典生成" value="" />
              </el-select>
            </el-form-item>
            <el-form-item label="增值服务名称" prop="itemName">
              <el-input
                v-model="queryParams.itemName"
                placeholder="请输入增值服务名称"
                clearable
                size="small"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="增值服务单价" prop="itemPrice">
              <el-input
                v-model="queryParams.itemPrice"
                placeholder="请输入增值服务单价"
                clearable
                size="small"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="增值服务积分" prop="itemNeedpoint">
              <el-input
                v-model="queryParams.itemNeedpoint"
                placeholder="请输入增值服务积分"
                clearable
                size="small"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="增值服务总价" prop="itemTotalPrice">
              <el-input
                v-model="queryParams.itemTotalPrice"
                placeholder="请输入增值服务总价"
                clearable
                size="small"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="增值服务总积分" prop="itemTotalNeedpoint">
              <el-input
                v-model="queryParams.itemTotalNeedpoint"
                placeholder="请输入增值服务总积分"
                clearable
                size="small"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="增值服务购买数量" prop="itemCount">
              <el-input
                v-model="queryParams.itemCount"
                placeholder="请输入增值服务购买数量"
                clearable
                size="small"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="积分记录id" prop="integralRecordId">
              <el-input
                v-model="queryParams.integralRecordId"
                placeholder="请输入积分记录id"
                clearable
                size="small"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="机构id" prop="institutionId">
              <el-input
                v-model="queryParams.institutionId"
                placeholder="请输入机构id"
                clearable
                size="small"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="年级id" prop="gradeId">
              <el-input
                v-model="queryParams.gradeId"
                placeholder="请输入年级id"
                clearable
                size="small"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="班级id" prop="classId">
              <el-input
                v-model="queryParams.classId"
                placeholder="请输入班级id"
                clearable
                size="small"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="孩子id" prop="childId">
              <el-input
                v-model="queryParams.childId"
                placeholder="请输入孩子id"
                clearable
                size="small"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="用户id" prop="memberId">
              <el-input
                v-model="queryParams.memberId"
                placeholder="请输入用户id"
                clearable
                size="small"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="订单状态,对应字典表sys_dictionary中OrderStatusType类型" prop="orderStatus">
              <el-select v-model="queryParams.orderStatus" placeholder="请选择订单状态,对应字典表sys_dictionary中OrderStatusType类型" clearable size="small">
                <el-option label="请选择字典生成" value="" />
              </el-select>
            </el-form-item>
            <el-form-item label="订单状态,对应字典表sys_dictionary中OrderStatusType类型" prop="orderStatusName">
              <el-input
                v-model="queryParams.orderStatusName"
                placeholder="请输入订单状态,对应字典表sys_dictionary中OrderStatusType类型"
                clearable
                size="small"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="回调记录id" prop="notifyId">
              <el-input
                v-model="queryParams.notifyId"
                placeholder="请输入回调记录id"
                clearable
                size="small"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="支付渠道,对应字典表sys_dictionary中PayMode类型" prop="payMode">
              <el-input
                v-model="queryParams.payMode"
                placeholder="请输入支付渠道,对应字典表sys_dictionary中PayMode类型"
                clearable
                size="small"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="视频服务,套餐用户组,用户member_id,多个用英文逗号分隔" prop="home">
              <el-input
                v-model="queryParams.home"
                placeholder="请输入视频服务,套餐用户组,用户member_id,多个用英文逗号分隔"
                clearable
                size="small"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="增值服务购买月数" prop="monthCount">
              <el-input
                v-model="queryParams.monthCount"
                placeholder="请输入增值服务购买月数"
                clearable
                size="small"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="记录状态,对应字典表sys_dictionary中Status类型" prop="status">
              <el-select v-model="queryParams.status" placeholder="请选择记录状态,对应字典表sys_dictionary中Status类型" clearable size="small">
                <el-option label="请选择字典生成" value="" />
              </el-select>
            </el-form-item>
            <el-form-item label="记录状态,对应字典表sys_dictionary中Status类型" prop="createUser">
              <el-input
                v-model="queryParams.createUser"
                placeholder="请输入记录状态,对应字典表sys_dictionary中Status类型"
                clearable
                size="small"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="记录状态,对应字典表sys_dictionary中Status类型" prop="updateUser">
              <el-input
                v-model="queryParams.updateUser"
                placeholder="请输入记录状态,对应字典表sys_dictionary中Status类型"
                clearable
                size="small"
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
             -->
    </el-form>
    <el-row :gutter="10" class="mb8">
      <!--      <el-col :span="1.5">
              <el-button
                type="primary"
                plain
                icon="el-icon-plus"
                size="mini"
                @click="handleAdd"
                v-hasPermi="['tongban:config:add']"
              >新增</el-button>
            </el-col>
            <el-col :span="1.5">
              <el-button
                type="success"
                plain
                icon="el-icon-edit"
                size="mini"
                :disabled="single"
                @click="handleUpdate"
                v-hasPermi="['tongban:config:edit']"
              >修改</el-button>
            </el-col>
            <el-col :span="1.5">
              <el-button
                type="danger"
                plain
                icon="el-icon-delete"
                size="mini"
                :disabled="multiple"
                @click="handleDelete"
                v-hasPermi="['tongban:config:remove']"
              >删除</el-button>
            </el-col>-->
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['tongban:config:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>


    <el-table v-loading="loading" :data="orderList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <!--      <el-table-column label="增值服务订单id" align="center" prop="valueAddedServiceOrderId" />-->
      <el-table-column label="增值服务订单号" align="center" prop="valueAddedServiceOrderNo" />
      <!--      <el-table-column label="增值服务项id" align="center" prop="itemId" />
            <el-table-column label="增值服务类型,对应字典表sys_dictionary中ValueAddedServiceType" align="center" prop="itemType" />-->
      <el-table-column label="增值服务名称" align="center" prop="itemName" />
      <!--      <el-table-column label="增值服务单价" align="center" prop="itemPrice" />
            <el-table-column label="增值服务积分" align="center" prop="itemNeedpoint" />-->
      <el-table-column label="增值服务总价" align="center" prop="itemTotalPrice" />
      <!--      <el-table-column label="增值服务总积分" align="center" prop="itemTotalNeedpoint" />
            <el-table-column label="增值服务购买数量" align="center" prop="itemCount" />
            <el-table-column label="积分记录id" align="center" prop="integralRecordId" />-->
      <el-table-column label="机构名称" align="center" prop="institutionName" />
      <!--      <el-table-column label="年级id" align="center" prop="gradeId" />-->
      <el-table-column label="班级名称" align="center" prop="className" />
      <el-table-column label="孩子名称" align="center" prop="childName" />
      <el-table-column label="用户号码" align="center" prop="memberMobile" />
      <!--      <el-table-column label="订单状态" align="center" prop="orderStatus" />-->
      <el-table-column label="订单状态" align="center" prop="orderStatusName" />
      <!--      <el-table-column label="回调记录id" align="center" prop="notifyId" />-->
      <el-table-column label="支付渠道" align="center" prop="payMode" />
      <!--      <el-table-column label="视频服务,套餐用户组,用户member_id,多个用英文逗号分隔" align="center" prop="home" />-->
      <!--      <el-table-column label="增值服务购买月数" align="center" prop="monthCount" />-->
      <!--      <el-table-column label="记录状态" align="center" prop="status" />-->
      <el-table-column label="创建时间" align="center" prop="createTime" />
      <!--      <el-table-column label="记录状态,对应字典表sys_dictionary中Status类型" align="center" prop="createUser" />-->
      <!--      <el-table-column label="记录状态,对应字典表sys_dictionary中Status类型" align="center" prop="updateUser" />-->
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" v-if="false">
        <template slot-scope="scope">
          <!--          <el-button
                      size="mini"
                      type="text"
                      icon="el-icon-edit"
                      @click="handleUpdate(scope.row)"
                      v-hasPermi="['tongban:order:edit']"
                    >修改</el-button>-->
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['tongban:order:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改增值服务订单(视频,听书)对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="增值服务订单号" prop="valueAddedServiceOrderNo">
          <el-input v-model="form.valueAddedServiceOrderNo" placeholder="请输入增值服务订单号" />
        </el-form-item>
        <el-form-item label="增值服务项id" prop="itemId">
          <el-input v-model="form.itemId" placeholder="请输入增值服务项id" />
        </el-form-item>
        <el-form-item label="增值服务类型,对应字典表sys_dictionary中ValueAddedServiceType" prop="itemType">
          <el-select v-model="form.itemType" placeholder="请选择增值服务类型,对应字典表sys_dictionary中ValueAddedServiceType">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="增值服务名称" prop="itemName">
          <el-input v-model="form.itemName" placeholder="请输入增值服务名称" />
        </el-form-item>
        <el-form-item label="增值服务单价" prop="itemPrice">
          <el-input v-model="form.itemPrice" placeholder="请输入增值服务单价" />
        </el-form-item>
        <el-form-item label="增值服务积分" prop="itemNeedpoint">
          <el-input v-model="form.itemNeedpoint" placeholder="请输入增值服务积分" />
        </el-form-item>
        <el-form-item label="增值服务总价" prop="itemTotalPrice">
          <el-input v-model="form.itemTotalPrice" placeholder="请输入增值服务总价" />
        </el-form-item>
        <el-form-item label="增值服务总积分" prop="itemTotalNeedpoint">
          <el-input v-model="form.itemTotalNeedpoint" placeholder="请输入增值服务总积分" />
        </el-form-item>
        <el-form-item label="增值服务购买数量" prop="itemCount">
          <el-input v-model="form.itemCount" placeholder="请输入增值服务购买数量" />
        </el-form-item>
        <el-form-item label="积分记录id" prop="integralRecordId">
          <el-input v-model="form.integralRecordId" placeholder="请输入积分记录id" />
        </el-form-item>
        <el-form-item label="机构id" prop="institutionId">
          <el-input v-model="form.institutionId" placeholder="请输入机构id" />
        </el-form-item>
        <el-form-item label="年级id" prop="gradeId">
          <el-input v-model="form.gradeId" placeholder="请输入年级id" />
        </el-form-item>
        <el-form-item label="班级id" prop="classId">
          <el-input v-model="form.classId" placeholder="请输入班级id" />
        </el-form-item>
        <el-form-item label="孩子id" prop="childId">
          <el-input v-model="form.childId" placeholder="请输入孩子id" />
        </el-form-item>
        <el-form-item label="用户id" prop="memberId">
          <el-input v-model="form.memberId" placeholder="请输入用户id" />
        </el-form-item>
        <el-form-item label="订单状态,对应字典表sys_dictionary中OrderStatusType类型">
          <el-radio-group v-model="form.orderStatus">
            <el-radio label="1">请选择字典生成</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="订单状态,对应字典表sys_dictionary中OrderStatusType类型" prop="orderStatusName">
          <el-input v-model="form.orderStatusName" placeholder="请输入订单状态,对应字典表sys_dictionary中OrderStatusType类型" />
        </el-form-item>
        <el-form-item label="回调记录id" prop="notifyId">
          <el-input v-model="form.notifyId" placeholder="请输入回调记录id" />
        </el-form-item>
        <el-form-item label="支付渠道,对应字典表sys_dictionary中PayMode类型" prop="payMode">
          <el-input v-model="form.payMode" placeholder="请输入支付渠道,对应字典表sys_dictionary中PayMode类型" />
        </el-form-item>
        <el-form-item label="视频服务,套餐用户组,用户member_id,多个用英文逗号分隔" prop="home">
          <el-input v-model="form.home" placeholder="请输入视频服务,套餐用户组,用户member_id,多个用英文逗号分隔" />
        </el-form-item>
        <el-form-item label="增值服务购买月数" prop="monthCount">
          <el-input v-model="form.monthCount" placeholder="请输入增值服务购买月数" />
        </el-form-item>
        <el-form-item label="记录状态,对应字典表sys_dictionary中Status类型">
          <el-radio-group v-model="form.status">
            <el-radio label="1">请选择字典生成</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="记录状态,对应字典表sys_dictionary中Status类型" prop="createUser">
          <el-input v-model="form.createUser" placeholder="请输入记录状态,对应字典表sys_dictionary中Status类型" />
        </el-form-item>
        <el-form-item label="记录状态,对应字典表sys_dictionary中Status类型" prop="updateUser">
          <el-input v-model="form.updateUser" placeholder="请输入记录状态,对应字典表sys_dictionary中Status类型" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listOrder, getOrder, delOrder, addOrder, updateOrder, exportOrder } from "@/api/tongban/order";
import {listInstitutionData} from "@/api/tongban/institution";
import {listInstitutionClass} from "@/api/tongban/class";
import {listChild, listInstitutionChild} from "@/api/tongban/child";
import {listGrade, listInstitutionGrade} from "@/api/tongban/grade";

export default {
  name: "Order",
  components: {
  },
  props: [],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 增值服务订单(视频,听书)表格数据
      orderList: [],
      deptList: [],
      gradeList:[],
      classList:[],
      childList:[],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        valueAddedServiceOrderNo: null,
        itemId: null,
        itemType: null,
        itemName: null,
        itemPrice: null,
        itemNeedpoint: null,
        itemTotalPrice: null,
        itemTotalNeedpoint: null,
        itemCount: null,
        integralRecordId: null,
        institutionId: null,
        gradeId: null,
        classId: null,
        childId: null,
        memberId: null,
        orderStatus: null,
        orderStatusName: null,
        notifyId: null,
        payMode: null,
        home: null,
        monthCount: null,
        status: null,
        createUser: null,
        createTimeStart: null,
        createTimeEnd: null,
        updateUser: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        orderStatus: [],
        payMode: [],
        createTimeStart: [{
          required: true,
          message: '请选择开始时间',
          trigger: 'change'
        }],
        createTimeEnd: [],
      },
      orderStatusOptions: [{
        "label": "待支付",
        "value": 1
      }, {
        "label": "已取消",
        "value": 2
      }, {
        "label": "已支付",
        "value": 3
      }, {
        "label": "已发货-待收货",
        "value": 4
      }, {
        "label": "交易完成",
        "value": 5
      }],
      payModeOptions: [{
        "label": "支付宝",
        "value": "AliPay"
      }, {
        "label": "微信",
        "value": "WXPay"
      }, {
        "label": "小程序",
        "value": "AppletsPay"
      }],
    };
  },

  computed: {},
  watch: {},
  mounted() {},
  created() {
    this.getList();
    listInstitutionData().then(res => {
      this.deptList = res.data;
    })
  },
  methods: {
    /** 查询年级*/
    selectGrade(id){
      listInstitutionGrade(id).then(res =>{
        this.gradeList = res.data;
        console.log(id);
      })
    },

    /** 查询班级*/
    selectClass(id){
      listInstitutionClass(id).then(response => {
        this.classList = response.data;
        //this.form.classId = this.classList[0];
        console.log(id);
      })
    },

    /** 查询孩子*/
    selectChild(id){
      listInstitutionChild(id).then(res =>{
        this.childList = res.data;
        console.log(id)
      })
    },

    /** 查询增值服务订单(视频,听书)列表 */
    getList() {
      this.loading = true;
      listOrder(this.queryParams).then(response => {
        this.orderList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        valueAddedServiceOrderId: null,
        valueAddedServiceOrderNo: null,
        itemId: null,
        itemType: null,
        itemName: null,
        itemPrice: null,
        itemNeedpoint: null,
        itemTotalPrice: null,
        itemTotalNeedpoint: null,
        itemCount: null,
        integralRecordId: null,
        institutionId: null,
        gradeId: null,
        classId: null,
        childId: null,
        memberId: null,
        orderStatus: null,
        orderStatusName: null,
        notifyId: null,
        payMode: null,
        home: null,
        monthCount: null,
        status: null,
        createTime: null,
        createUser: null,
        updateTime: null,
        updateUser: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.valueAddedServiceOrderId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加增值服务订单(视频,听书)";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const valueAddedServiceOrderId = row.valueAddedServiceOrderId || this.ids
      getOrder(valueAddedServiceOrderId).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改增值服务订单(视频,听书)";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs['elForm'].validate(valid => {
        if (!valid) return
        // TODO 提交表单
      });
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.valueAddedServiceOrderId != null) {
            updateOrder(this.form).then(response => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addOrder(this.form).then(response => {
              this.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const valueAddedServiceOrderIds = row.valueAddedServiceOrderId || this.ids;
      this.$confirm('是否确认删除增值服务订单(视频,听书)编号为"' + valueAddedServiceOrderIds + '"的数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function() {
        return delOrder(valueAddedServiceOrderIds);
      }).then(() => {
        this.getList();
        this.msgSuccess("删除成功");
      })
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有增值服务订单(视频,听书)数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function() {
        return exportOrder(queryParams);
      }).then(response => {
        this.download(response.msg);
      })
    },


  },
};
</script>
